from pprint import pprint
import urllib.request

url = 'http://www.baidu.com'
# 得到HttpResponse对象
response = urllib.request.urlopen(url)
print(type(response))
# read 读取的数据为二进制，我们需要将他进行解码
content = response.read().decode('utf-8')
pprint(content)

